//方法1
//递归

#include<iostream>
#include<string>
#include<vector>
using namespace std;


//   Definition for singly-linked list.
  struct ListNode {
      int val;
      ListNode *next;
      ListNode(int x) : val(x), next(NULL) {}
 };
 


int reverse_(ListNode* head,vector<int>&tmp)
{
    if(head->next==NULL)
    {
        return head->val;
    }
    tmp.push_back(reverse_(head->next,tmp));
    return head->val;
}

class Solution {
public:
    vector<int> reversePrint(ListNode* head) 
    {
        vector<int> tmp;
        if(head==NULL)
        return tmp;
        tmp.push_back(reverse_(head,tmp));
        return tmp;
    }
};